<template>
	<view class="wrap safe-area flex align-center just-center" v-if="dataInfo">
		<view class="wrap-content flex column align-center">
			<view class="one">
				基本账户
			</view>
			
			<view class="money flex align-base">
				<text class="unit">￥</text>
				
				<text>{{ dataInfo.total }}</text>
			</view>
			
			<view class="balance-box flex align-center">
				<view class="box-item flex column align-center">
					<view class="title">
						可用余额
					</view>
					
					<view class="balance">
						<text class="unit">￥</text>
						<text>{{ dataInfo.can_use }}</text>
					</view>
				</view>
				
				<view class="line"></view>
				
				<view class="box-item flex column align-center">
					<view class="title">
						不可用余额
					</view>
					
					<view class="balance">
						<text class="unit">￥</text>
						<text>{{ dataInfo.nocan_use }}</text>
					</view>
				</view>
			</view>
			
			<view class="btn-bg flex column">
				<view class="btn btn-one" @click="onWithdrwal()">
					提现
				</view>
				
				<view class="btn btn-two" @click="onDetails()">
					明细
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { GetShopFund } from "@/utils/API.js";
	export default {
		data() {
			return {
				dataInfo: null,
			};
		},
		onShow() {
			this.getData();
		},
		methods: {
			/**
			 * 提现
			 */
			onWithdrwal() {
				this.$wanlshop.to(`/pages/user/money/withdraw`);
			},
			/**
			 * 明细
			 */
			onDetails() {
				this.$wanlshop.to("/pages/new/fundDetails/fundDetails")
			},
			/**
			 * 网络请求
			 */
			getData() {
				GetShopFund().then(res => {
					this.dataInfo = res.data;
				})
			},
		}
	}
</script>

<style lang="scss">
	page {
		background-color: white;
	}
	
	.wrap {
		width: 100vw;
		height: 100vh;
		overflow: hidden;
		padding: 0rpx 50rpx;
		box-sizing: border-box;
		
		.wrap-content {
			width: 100%;
			overflow: hidden;
			
			.one {
				color: #3D3D3D;
				font-size: 36rpx;
			}
			
			.money {
				margin-top: 20rpx;
				color: #3D3D3D;
				font-size: 70rpx;
				font-weight: bold;
				
				.unit {
					font-size: 36rpx !important;
				}
			}
			
			.balance-box {
				margin-top: 150rpx;
				width: 100%;
				overflow: hidden;
				
				.box-item {
					flex: 1;
					overflow: hidden;
					gap: 20rpx;
					
					.title {
						color: #999999;
						font-size: 36rpx;
					}
					
					.balance {
						color: #3D3D3D;
						font-size: 40rpx;
						overflow: hidden;
						font-weight: bold;
						
						.unit {
							font-size: 36rpx !important;
						}
					}
				}
				
				.line {
					width: 2rpx;
					height: 110rpx;
					background-color: #D8D8D8;
					overflow: hidden;
				}
			}
			
			.btn-bg {
				margin-top: 300rpx;
				overflow: hidden;
				gap: 50rpx;
				
				.btn {
					width: 415rpx;
					height: 82rpx;
					line-height: 82rpx;
					text-align: center;
					border-radius: 50rpx;
					overflow: hidden;
					font-size: 33rpx;
				}
				
				.btn-one {
					background-color: #84BD00;
					color: white;
				}
				
				.btn-two {
					background-color: #F7F7F7;
					color: #333333;
				}
			}
		}
	}
</style>
